[PATCH 105/144] hsa: check for clang -target hsail64
authorAndreas Beckmann <anbe@debian.org>
Mon, 29 Nov 2021 21:25:10 +0000 (22:25 +0100)
committerAndreas Beckmann <anbe@debian.org>
Fri, 7 Jan 2022 23:55:22 +0000 (23:55 +0000)
Gbp-Pq: Name 0105-hsa-check-for-clang-target-hsail64.patch

cmake/HSA.cmake

index 08eb3ac9ee0bfd0692ce656c7c7918eb03a00501..4381461f6676ca2eaa5daab9cd0b4b171fbb3aec 100644 (file)
@@ -32,7 +32,16 @@ else()
   if(RESULT)
     message(FATAL_ERROR "LLVM support for amdgcn--amdhsa target is required")
   endif()
-  set(HSAIL_ENABLED 1)
+  # test that Clang supports the hsail64 target
+  message(CHECK_START "Check if Clang accepts -target hsail64")
+  custom_try_compile_clangxx("" "return 0;" RESULT "-target" "hsail64" "-emit-llvm" "-S")
+  if(RESULT)
+    message(CHECK_FAIL "no")
+    set(HSAIL_ENABLED 0)
+  else()
+    message(CHECK_PASS "yes")
+    set(HSAIL_ENABLED 1)
+  endif()
 endif()
 
 if (NOT DEFINED AMD_HSA)